#创建一个名为Restaurant的类，为__init__()方法设置两个属性，restaurant_name和cuisine_type
class Restaurant():
    def __init__(self , restaurant_name , cuisine_type):
        self.restaurant_name = restaurant_name
        self.cuisine_type = cuisine_type
        self.number_served = 0
    def describe_restaurant(self):
        print(f'餐厅名字是{self.restaurant_name}')
        print(self.cuisine_type)
    def open_restaurant(self):
        print(f'{self.restaurant_name}正在营业')
        print(f'有{self.number_served}人正在就餐')
    #每次传递新的就餐人数
    def set_number_served(self,number_served):
        self.number_served = number_served
    #就餐人数递增
    def increase_number_served(self,increase):
        self.number_served += increase
#为Restaurant类添加一个名为number_served的属性，将其默认值设为0，根据类创建一个名为restaurant的实例，打印有多少人曾在此就餐
first_restaurant = Restaurant('kfc','on')
first_restaurant.describe_restaurant()
first_restaurant.open_restaurant()
first_restaurant.set_number_served(5)
first_restaurant.open_restaurant()
first_restaurant.increase_number_served(2)
first_restaurant.open_restaurant()
second_restaurant = Restaurant('麦当劳','on')
second_restaurant.describe_restaurant()
third_restaurant = Restaurant('塔斯汀','on')
third_restaurant.describe_restaurant()


#创建一个名为user的类，包含属性first_name,last_name
class User():
    def __init__(self,first_name,last_name,age,sex):
        self.first_name = first_name
        self.last_name = last_name
        self.age = age
        self.sex = sex
        self.login_attempts = 0
    def describe_user(self):
        print(f'大家好，我的名字是:{self.first_name} {self.last_name},我今年{self.age}岁了，我的性别是{self.sex},我登陆了{self.login_attempts}次')
    def increment_login_attempts(self):
        self.login_attempts += 1
    def reset_login_attempts(self):
        self.login_attempts = 0
my_user = User('sam','jack',13,'man')
my_user.describe_user()
#添加一个login_attempts的属性，编写一个方法increment_login_attempts用来将属性login_attempts加1，
your_user = User('john','jack',12,'man')
your_user.describe_user()
your_user.increment_login_attempts()
your_user.increment_login_attempts()
your_user.increment_login_attempts()
your_user.describe_user()
your_user.reset_login_attempts()
your_user.describe_user()